<template>
  <div>
    <br/>
    父组件传给子组件数据：
    <!-- {{ `name:${props.name},age:${props.sex}` }} <br/> -->
    
    
    
    <!-- <slot :message="message"></slot> -->


    <button type="button" @click="emitToParent">父组件点击传参</button>
    
    
    <!-- {{ `sex:${props1.sex},hobby:${props1.hobby}` }} <br/> -->


    <!-- {{ `msg:${props2.msg},foo:${props2.foo}` }} <br/> -->



    <!-- {{ `tsString:${propsTs.tsString},fotsNumbero:${propsTs.tsNumber}` }} <br/> -->
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';
const props = defineProps(['name', 'age', 'sex'])

// console.log('props', props);
const message = ref('Hello, world!')









// const props1 = defineProps({sex:String,hobby:String})
// const propsTs = defineProps<{tsString:string;tsNumber?:number}>()

// let props2 = defineProps({
//   msg: {
//     type: String,
//     default: 'mssss',
//     required: true 
//   },
//   foo: {
//     type: Number,
//     default: 0
//   }
// })
// defineEmits 做初始化注册
const emit = defineEmits(['event-to-parent','test-name'])
let emitToParent = () => {
  // emit 实li发布
  emit('event-to-parent', {name:'ba'})
}


</script>
